package com.zjj.concurrent.mode;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * @author zhanglei.zjj
 * @description TODO
 * @date 2023/6/6 22:59
 */
public class SafeDateFormat {
    //定义ThreadLocal变量
    static final ThreadLocal<DateFormat> tl = ThreadLocal.withInitial(
            () -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));

    static DateFormat get() {
        return tl.get();
    }

}

